<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Unit Model
 *
 * @package     VisualQ Local System
 * @author      CSU OJT Students '10 - '11 (Michael Roland B. Martin)
 * @copyright   Copyright (c) 2010 - 2011, Bitstop Network Services, Inc.
 * @version     1.0 January 28, 2011
 */

class Unit_model extends Model {

    function Unit_model()
    {
        parent::Model();
        $this->load->database();

        $this->CI =& get_instance();
    }

    /**
     * Count the same unit type
     *
     * Used by:
     *      manager/register_unit/
     *
     * @param	string
     *      type            :   unit type
     * @return  string
     *      query           :   the query result
     */
    function get_unit_type_count($type)
    {
        $this->db->like('user_data', $type);
        return $this->db->get('ci_sessions');
    }

    /**
     * Set unit session
     *
     * Used by:
     *      manager/register_unit/
     *
     * @param	array
     *      name            :   unit name
     *      type            :   unit type
     * @return  string
     *      query           :   the query result
     */
    function register($params)
    {
        $data = array(
            'unit_name'          => $params['unit_name'],
            'unit_type'          => $params['unit_type']
        );

        $this->session->set_userdata($data);
    }

}

/* End of file unit_model.php */
/* Location: ./system/application/model/unit_model.php */